import request from '@/utils/request';

// 查询角色列表
export function listRole(query) {
  return request.get('/system/role/list', query)
}

// 查询角色详细
export function getRole(roleId) {
  return request.get('/system/role/' + roleId)
}

// 新增角色
export function addRole(data) {
  return request.postJson('/system/role', data)
}

// 修改角色
export function updateRole(data) {
  return request.put('/system/role', data)
}

// 角色数据权限
export function dataScope(data) {
  return request.put('/system/role/dataScope', data)
}

// 角色状态修改
export function changeRoleStatus(roleId, status) {
  const data = {
    roleId,
    status
  }
  return request.put('/system/role/changeStatus', data)
}

// 删除角色
export function delRole(roleId) {
  return request.delete('/system/role/' + roleId)
}

// 导出角色
export function exportRole(query) {
  return request.get('/system/role/export', query)
}
